package org.budo.phone.freeswitch.util;

import org.freeswitch.esl.client.inbound.Client;

import lombok.extern.slf4j.Slf4j;

/**
 * @author lmw
 */
@Slf4j
public class EslUtil {
    public static void closeQuietly(Client client) {
        if (null == client) {
            log.error("#45 closeQuietly, client=" + client);
            return;
        }

        try {
            client.close();
        } catch (Throwable e) {
            log.error("#52 closeQuietly, client=" + client + ", e=" + e);
        }
    }

    public static boolean canSend(Client client) {
        if(null == client){
            log.error("#46 canSend, client is null");
            return false;
        }

        try {
            return client.canSend();
        } catch (Throwable e) {
            log.error("#53 canSend, client=" + client + ", e=" + e);
            return false;
        }
    }
}